#!/bin/bash
#leao:Sat Aug 24 09:46:33 AM CST 2024
build(){
typeset -u capital
capital=$1
touch $1.h  
echo "#ifndef __${capital}_H_
#define __${capital}_H_
#define ERROE_CHECK(ret, num, msg) \
    {                              \
        if (ret == num)            \
        {                          \
            perror(msgsnd);        \
            return -1              \
        }                          \
    }

#endif" > "$1.h"

}


if [ -z "$1" ]
then 
    echo "error:argcs"
    exit
fi
if [ -e $1 ]
then
echo "${1}已经存在,是否重构y/Y,退出程序n/N:"
read val
case $val in
    [yY]*)
        build $1;;
    [nN]*)
        exit 1;
esac
else
build $1
fi


